{"ast":null,"code":"import { millisecondsInHour, millisecondsInMinute, millisecondsInSecond } from \"../../constants/index.js\";\nimport { numericPatterns } from \"./constants.js\";\nexport function mapValue(parseFnResult, mapFn) {\n  if (!parseFnResult) {\n    return parseFnResult;\n  }\n  return {\n    value: mapFn(parseFnResult.value),\n    rest: parseFnResult.rest\n  };\n}\nexport function parseNumericPattern(pattern, dateString) {\n  var matchResult = dateString.match(pattern);\n  if (!matchResult) {\n    return null;\n  }\n  return {\n    value: parseInt(matchResult[0], 10),\n    rest: dateString.slice(matchResult[0].length)\n  };\n}\nexport function parseTimezonePattern(pattern, dateString) {\n  var matchResult = dateString.match(pattern);\n  if (!matchResult) {\n    return null;\n  } // Input is 'Z'\n\n  if (matchResult[0] === 'Z') {\n    return {\n      value: 0,\n      rest: dateString.slice(1)\n    };\n  }\n  var sign = matchResult[1] === '+' ? 1 : -1;\n  var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n  var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n  var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n  return {\n    value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),\n    rest: dateString.slice(matchResult[0].length)\n  };\n}\nexport function parseAnyDigitsSigned(dateString) {\n  return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);\n}\nexport function parseNDigits(n, dateString) {\n  switch (n) {\n    case 1:\n      return parseNumericPattern(numericPatterns.singleDigit, dateString);\n    case 2:\n      return parseNumericPattern(numericPatterns.twoDigits, dateString);\n    case 3:\n      return parseNumericPattern(numericPatterns.threeDigits, dateString);\n    case 4:\n      return parseNumericPattern(numericPatterns.fourDigits, dateString);\n    default:\n      return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), dateString);\n  }\n}\nexport function parseNDigitsSigned(n, dateString) {\n  switch (n) {\n    case 1:\n      return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);\n    case 2:\n      return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);\n    case 3:\n      return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);\n    case 4:\n      return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);\n    default:\n      return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), dateString);\n  }\n}\nexport function dayPeriodEnumToHours(dayPeriod) {\n  switch (dayPeriod) {\n    case 'morning':\n      return 4;\n    case 'evening':\n      return 17;\n    case 'pm':\n    case 'noon':\n    case 'afternoon':\n      return 12;\n    case 'am':\n    case 'midnight':\n    case 'night':\n    default:\n      return 0;\n  }\n}\nexport function normalizeTwoDigitYear(twoDigitYear, currentYear) {\n  var isCommonEra = currentYear > 0; // Absolute number of the current year:\n  // 1 -> 1 AC\n  // 0 -> 1 BC\n  // -1 -> 2 BC\n\n  var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n  var result;\n  if (absCurrentYear <= 50) {\n    result = twoDigitYear || 100;\n  } else {\n    var rangeEnd = absCurrentYear + 50;\n    var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n    var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n    result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n  }\n  return isCommonEra ? result : 1 - result;\n}\nexport function isLeapYearIndex(year) {\n  return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}","map":{"version":3,"names":["millisecondsInHour","millisecondsInMinute","millisecondsInSecond","numericPatterns","mapValue","parseFnResult","mapFn","value","rest","parseNumericPattern","pattern","dateString","matchResult","match","parseInt","slice","length","parseTimezonePattern","sign","hours","minutes","seconds","parseAnyDigitsSigned","anyDigitsSigned","parseNDigits","n","singleDigit","twoDigits","threeDigits","fourDigits","RegExp","parseNDigitsSigned","singleDigitSigned","twoDigitsSigned","threeDigitsSigned","fourDigitsSigned","dayPeriodEnumToHours","dayPeriod","normalizeTwoDigitYear","twoDigitYear","currentYear","isCommonEra","absCurrentYear","result","rangeEnd","rangeEndCentury","Math","floor","isPreviousCentury","isLeapYearIndex","year"],"sources":["/data/messenger.client/node_modules/date-fns/esm/parse/_lib/utils.js"],"sourcesContent":["import { millisecondsInHour, millisecondsInMinute, millisecondsInSecond } from \"../../constants/index.js\";\nimport { numericPatterns } from \"./constants.js\";\nexport function mapValue(parseFnResult, mapFn) {\n  if (!parseFnResult) {\n    return parseFnResult;\n  }\n\n  return {\n    value: mapFn(parseFnResult.value),\n    rest: parseFnResult.rest\n  };\n}\nexport function parseNumericPattern(pattern, dateString) {\n  var matchResult = dateString.match(pattern);\n\n  if (!matchResult) {\n    return null;\n  }\n\n  return {\n    value: parseInt(matchResult[0], 10),\n    rest: dateString.slice(matchResult[0].length)\n  };\n}\nexport function parseTimezonePattern(pattern, dateString) {\n  var matchResult = dateString.match(pattern);\n\n  if (!matchResult) {\n    return null;\n  } // Input is 'Z'\n\n\n  if (matchResult[0] === 'Z') {\n    return {\n      value: 0,\n      rest: dateString.slice(1)\n    };\n  }\n\n  var sign = matchResult[1] === '+' ? 1 : -1;\n  var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n  var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n  var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n  return {\n    value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),\n    rest: dateString.slice(matchResult[0].length)\n  };\n}\nexport function parseAnyDigitsSigned(dateString) {\n  return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);\n}\nexport function parseNDigits(n, dateString) {\n  switch (n) {\n    case 1:\n      return parseNumericPattern(numericPatterns.singleDigit, dateString);\n\n    case 2:\n      return parseNumericPattern(numericPatterns.twoDigits, dateString);\n\n    case 3:\n      return parseNumericPattern(numericPatterns.threeDigits, dateString);\n\n    case 4:\n      return parseNumericPattern(numericPatterns.fourDigits, dateString);\n\n    default:\n      return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), dateString);\n  }\n}\nexport function parseNDigitsSigned(n, dateString) {\n  switch (n) {\n    case 1:\n      return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);\n\n    case 2:\n      return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);\n\n    case 3:\n      return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);\n\n    case 4:\n      return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);\n\n    default:\n      return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), dateString);\n  }\n}\nexport function dayPeriodEnumToHours(dayPeriod) {\n  switch (dayPeriod) {\n    case 'morning':\n      return 4;\n\n    case 'evening':\n      return 17;\n\n    case 'pm':\n    case 'noon':\n    case 'afternoon':\n      return 12;\n\n    case 'am':\n    case 'midnight':\n    case 'night':\n    default:\n      return 0;\n  }\n}\nexport function normalizeTwoDigitYear(twoDigitYear, currentYear) {\n  var isCommonEra = currentYear > 0; // Absolute number of the current year:\n  // 1 -> 1 AC\n  // 0 -> 1 BC\n  // -1 -> 2 BC\n\n  var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n  var result;\n\n  if (absCurrentYear <= 50) {\n    result = twoDigitYear || 100;\n  } else {\n    var rangeEnd = absCurrentYear + 50;\n    var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n    var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n    result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n  }\n\n  return isCommonEra ? result : 1 - result;\n}\nexport function isLeapYearIndex(year) {\n  return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,oBAAoB,EAAEC,oBAAoB,QAAQ,0BAA0B;AACzG,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAO,SAASC,QAAQ,CAACC,aAAa,EAAEC,KAAK,EAAE;EAC7C,IAAI,CAACD,aAAa,EAAE;IAClB,OAAOA,aAAa;EACtB;EAEA,OAAO;IACLE,KAAK,EAAED,KAAK,CAACD,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